#include "fuzzy_graph.h"
#include <qwt_plot_grid.h>

FuzzyGraph::FuzzyGraph(QWidget *parent):
        Plot(parent)
{

}


void FuzzyGraph::setLowX0(int value){
    lowX[0] = value;
}

void FuzzyGraph::setLowX1(int value){
    lowX[1] = value;
}

void FuzzyGraph::setLowX2(int value){
    lowX[2] = value;
}

void FuzzyGraph::setLowX3(int value){
    lowX[3] = value;
}

void FuzzyGraph::setMediumX0(int value){
    mediumX[0] = value;
}

void FuzzyGraph::setMediumX1(int value){
    mediumX[1] = value;
}

void FuzzyGraph::setMediumX2(int value){
    mediumX[2] = value;
}

void FuzzyGraph::setMediumX3(int value){
    mediumX[3] = value;
}

void FuzzyGraph::setHighX0(int value){
    highX[0] = value;
}

void FuzzyGraph::setHighX1(int value){
    highX[1] = value;
}

void FuzzyGraph::setHighX2(int value){
    highX[2] = value;
}

void FuzzyGraph::setHighX3(int value){
    highX[3] = value;
}


void FuzzyGraph::plotGraph()
{
    this->clear();

    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->attach(this);


    lowPlot = new QwtPlotCurve("FUZZY LOW");
    lowPlot->setPen(QPen(QColor(234,5,8),2));

    mediumPlot = new QwtPlotCurve("FUZZY MEDIUM");
    mediumPlot->setPen(QPen(QColor(19,117,18),2));

    highPlot = new QwtPlotCurve("FUZZY HIGH");
    highPlot->setPen(QPen(QColor(249,250,70),2));

    double y[4] = {0,1,1,0};

    lowPlot->setData(this->lowX,y,4);
    lowPlot->attach(this);

    mediumPlot->setData(this->mediumX,y,4);
    mediumPlot->attach(this);

    highPlot->setData(this->highX,y,4);
    highPlot->attach(this);

   replot();
}
